//
//  UIButton+Extension.swift
//  WeoboWithSteveLi
//
//  Created by SteveLi on 2017/9/18.
//  Copyright © 2017年 李军桦. All rights reserved.
//

import UIKit
extension UIButton{
    //遍历构造函数
    convenience init(imageName: String ,backImageName: String) {
    self.init()
        
        setImage(UIImage.init(named: imageName), for: UIControlState.normal)
        setImage(UIImage.init(named: imageName + "_hightlighted"), for: UIControlState.highlighted)
        setBackgroundImage(UIImage.init(named: backImageName), for: UIControlState.normal)
        setBackgroundImage(UIImage.init(named:backImageName + "_hightlighted"), for: UIControlState.highlighted)
        //会根据背景图片的大小调整尺寸
        sizeToFit()
    
    }

}
